import React, { Component } from 'react'
import { zhide } from '../utils/api';
import { withRouter } from 'react-router-dom';
import "./Zhide.scss"
 class Zhide extends Component {
    constructor(props) {
        super(props);
        this.state = {
            arr: []
        }

    }
    componentDidMount() {
        zhide().then((ok) => {
            // console.log(ok.data.list)
            this.setState({ arr: ok.data.list })

        })
    }
    render() {
        return (
            <div className='zhide'>
                <div className='settime'>
                    <div className='lbox'>
                        <h2>今日值得买</h2>
                        <div></div>
                    </div>
                    <div className='rbox'>
                        MORE >
                    </div>
                </div>
                <div className='zdlist'>
                    {
                        this.state.arr.map((val) => {
                            return (
                                <div>
                                    <img src={val.pic} alt="" />
                                    <p className='sname'>{val.name}</p>
                                    <p className='ms'>{val.salesPrice.name}￥:<span>{val.salesPrice.value}</span></p>
                                </div>
                            )
                        })
                    }
                </div>
            </div>
        )
    }
}


export default withRouter(Zhide)